﻿using System;
using G.Model.Runtime;
using G.Model;
using G.Runtime;
using G.Runtime.Actions;

namespace GameRuntimeLibrary.Model.Runtime.Actions
{
    class OwnAction : GameElementAction
    {
        private readonly GameElement _DestinationElement;

        public OwnAction(GameElement element, GameElement destination)
            : base(element, destination.Location)
        {
            _DestinationElement = destination;
        }

        public GameElement DestinationElement
        {
            get { return _DestinationElement; }
        }

        public override void Execute(GameSpace pGame)
        {
            //trigger.FireOwnEvent(Attacker, _DestinationElement);
            
            {
                GameEvent e = pGame.Globals.Events[
                    Constants.END_OF_MOVE];
                e.FireInvoke();
            }
            Attacker.FireElementMoved();
            
            pGame.Elements.Actions.Clear();
        }

    }
}
